<div class="properties-grid">
	<div class="row"><?php foreach ($listings as $listing) { ?> <?php 
		//get media for listing
		$media = $this->mdl_listingmapmodel->get_media($listing['Listing_ID'], "Cover", 1);
		?>
		<div class="property span3">
			<div class="image">
			<div class="content"><a
				href="detail.html?id=<?php echo $listing['Listing_ID']; ?>"></a> <?php if(isset($media->FileName) && isset($media->FileExtension)) { ?>
			<img
				src="<?php echo $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listing['Listing_ID'] . '/' . $media->FileName . '-270x200' . $media->FileExtension; ?>"
				alt=""> <?php } else { ?> <img
				src="<?php echo $this->config->item('HTTP_IMAGE'); ?>tmp/no-image.png"
				alt=""> <?php } ?></div>
			<!-- /.content -->
			
			<div class="price"><?php if($listing['Price_Min'] > 0) { ?> <?php echo $listing['PriceUnit'] . " " . number_format(($listing['Price_Min']), 0, '.', ','); ?>
			<?php } else { ?> <?php echo "Price On Application"; ?> <?php } ?></div>
			<!-- /.price --></div>
			<!-- /.image -->
		
			<div class="title">
			<h2><a href="detail.html?id=<?php echo $listing['Listing_ID']; ?>"> <?php echo html_entity_decode(character_limiter(ucwords(strtolower($listing['ProjectName'])), 16) , ENT_QUOTES, 'UTF-8'); ?>
			</a></h2>
			</div>
			<!-- /.title -->
			<div class="location"><?php
			//Locality
			//initiation
			$locality = "";
			//check subarea
			if (!empty($listing['Subarea'])) {
				$locality .= $listing['Subarea'] . ", ";
			}
			
			//check location
			if (!empty($listing['Location'])) {
				$locality .= $listing['Location'] . ", ";
			}
			
			//check city
			if (!empty($listing['City'])) {
				$locality .= $listing['City'];
			}
			
			if (!empty($locality)) {
				echo character_limiter($locality, 30);
			}
			?></div>
			<!-- /.location -->
			<div class="area"><span class="key">Area:</span><!-- /.key --> <span
				class="value"><?php echo number_format($listing['Size_Min']) . ' ' . $listing['SizeUnit']; ?></span><!-- /.value -->
			</div>
			<!-- /.area -->
			<div class="bedrooms">
			<div class="content"><?php echo $listing['Bedroom']; ?></div>
			</div>
			<!-- /.bedrooms -->
			<div class="bathrooms">
			<div class="content"><?php echo $listing['Bathroom']; ?></div>
			</div>
			<!-- /.bathrooms -->
			<div class="clearfix"></div>
			<div class="morelinks">
				<input type="text" class="btn btn-primary sepH_b contact_agent" value="Contact Agent"> 
				<input type="text" class="btn btn-primary sepH_b view_detail" value="View Detail"> 
				<input type="text" class="btn btn-primary sepH_b short_list" value="Short List"> 
				<input type="hidden" value="<?php echo $listing['Listing_ID']; ?>" name="morelinks" id="morelinks">
			</div>
		</div>
		<!-- /.property --> <?php } ?>
	</div>
	<!-- /.row -->
</div>
<!-- /.properties-grid -->
